$(00_dir_dev_src)/%.$(coc_source_extension) : $(00_dir_dev_inc)/%.$(coc_header_extension)
	$(00_show) ""                                                            ; \
	echo  "---------------------------------------- "                     ; \
	echo  "Compiling $<"                                                  ; \
	$(coc_compile_command) $(01_final_prj_inc_dir) $(01_compile_flags) $(01_final_prj_minus_d) $< -o $@


# automatic compilation of C++ source files of the project
# this source file was modified, so it is a good time to check if it 
# has new header files dependencies                                  

$(00_dir_dev_obj)/%.$(coc_obj_extension) : $(00_dir_dev_src)/%.$(coc_source_extension)
	$(00_show) ""                                                            ; \
	echo  "---------------------------------------- "                     ; \
	echo  "Compiling $<"                                                  ; \
	$(coc_compile_command) $(01_final_prj_inc_dir) $(01_compile_flags) $(01_final_prj_minus_d) $< -o $@



# automatic compilation of C source files of the project
$(00_dir_dev_obj)/%.$(coc_obj_extension) : $(00_dir_dev_src)/%.c
	$(00_show) ""                                                            ; \
	echo  "---------------------------------------- "                     ; \
	echo  "Compiling $<"                                                  ; \
	$(coc_compile_command) $(01_final_prj_inc_dir) $(01_compile_flags) $(01_final_prj_minus_d) $< -o $@ ;


# automatic generation of header code files from qt-designer '.$(qt_extension)' files
#$(00_dir_dev_inc)/%.$(coc_header_extension): $(00_dir_dev_inc)/%.$(qt_extension)
#	$(00_show) ""                                                            ; \
#	echo  "---------------------------------------- "                     ; \
#	echo  "Generating $@ from  $<"                                        ; \
#	uic  -o $@ $<                                                         ;

# automatic generation of source code files from qt-designer '.ui' files
#$(00_dir_dev_src)/%.$(coc_source_extension): $(00_dir_dev_src)/%.$(qt_extension)
#	$(00_show) ""                                                            ; \
#	echo  " ---------------------------------------- "                    ; \
#	echo  "Generating $@ from  $<"                                        ; \
#	uic -o $@ -impl $(00_dir_dev_code)/$*.$(coc_header_extension) $<                 ;

code_compile_ui: $(qt_code_hs) 
#$(qt_code_cpps) 

# **************  builds the code for a program
code_build_pgm : code_build_header 
	$(00_show) ""                                                           ; \
	echo "Building a program for $(00_project)"                             ; \
	$(coc_program_command) $(coc_program_prefix)$(00_project)$(coc_program_sufix)         \
		$(01_code_objs) $(01_final_prj_static_libs)                          \
		$(01_final_prj_lib_dir) $(01_final_prj_shared_libs)                  \
		$(coc_search_lib_dir)                                            ; \
	mv $(coc_program_prefix)$(00_project)$(coc_program_sufix) $(00_dir_product_bin)            ; 


# soname creation - not used

# 	mv $(coc_static_lib_prefix)$(00_project)$(coc_static_lib_sufix) $(00_dir_product_lib)              ; \
# 	mv $(coc_shared_lib_prefix)$(00_project)$(coc_shared_lib_sufix)* $(00_dir_product_lib)             ; \

# **************  builds the code for a static and shared library
code_build_lib : code_build_header code_compile
	$(00_show) ""                                                           ; \
	echo "Building a static lib for $(00_project)"                          ; \
	mkdir $(build_lib_dir) 2> /dev/null                                  ; \
	$(coc_static_lib_command) $(00_dir_product_lib)/$(coc_static_lib_prefix)$(00_project)$(coc_static_lib_sufix)            \
                $(01_code_objs) $(01_final_prj_static_libs) 2> /dev/null           ; \
	echo "Building a shared lib for $(00_project)"                          ; \
	$(coc_shared_lib_command)                                                      \
		$(00_dir_product_lib)/$(coc_shared_lib_prefix)$(00_project)$(coc_shared_lib_sufix).$(00_M_version).$(00_m_version).$(00_build_number) \
                $(01_code_objs) $(01_final_prj_static_libs)                          \
                $(01_final_prj_lib_dir) $(01_final_prj_shared_libs)                  \
		$(coc_shared_lib_soname)$(00_dir_product_lib)/$(coc_shared_lib_prefix)$(00_project)$(coc_shared_lib_sufix)      \
		$(coc_search_lib_dir)                                            ; \
	ldconfig -n $(00_dir_product_lib) 2> /dev/null                                  ; 


# **************  builds the code for just copying files
code_build_just_copy : code_build_header


# **************  installs the header files for the code
code_build_header :
	$(00_show) ""                                                           ; \
	if [ ! -d $(00_dir_dev_inc) ]; then                                           \
		mkdir -p $(00_dir_dev_inc) 2> /dev/null                             ; \
		touch $(00_dir_dev_inc)/dummy.h 2> /dev/null                        ; \
	fi                                                                   ;




#                            PUBLIC 

#@public@|code_compile|Compiles the Code of the Project
#@public_detailed@|code_compile|Syntax: 'make project=<project-name> [coc=<cpu-os-compiler>] [verbose=0/1]  [target=debug/release] code_compile
#@public_detailed@|code_compile|Where <project-name> is an existing project. Please rum 'make prj_list' to list all the avaiable projects.
#@public_detailed@|code_compile|Where <cpu-os-compiler> is the name of a file that contain definitions for a CPU, OS and compiler. Please, run 'make coc_list' to list all the combinations avaiables.
code_compile : $(01_code_objs) $(01_code_srcs)

# code_compile_ui 




#@public@|code_compile_chain|Compiles the code of all the projects that this project depends on, and the project itself.
#@public_detailed@|code_compile_chain|Syntax: 'make project=<project-name> [coc=<cpu-os-compiler>] [verbose=0/1]  [target=debug/release] code_compile_chain
#@public_detailed@|code_compile_chain|Where <project-name> is an existing project. Please rum 'make prj_list' to list all the avaiable projects.
#@public_detailed@|code_compile_chain|Where <cpu-os-compiler> is the name of a file that contain definitions for a CPU, OS and compiler. Please, run 'make coc_list' to list all the combinations avaiables.

code_compile_chain :
	$(00_show) ""                                                           ; \
	echo "**************************************** "                     ; \
	echo -n "Compiles the code of all Projects that $(00_project) "         ; \
	echo "depend on"                                                     ; \
	$(00_make_cmd) 01_prj_chain chain_target=code_compile                      ; \
	$(00_make_cmd) code_compile                                             ;


#@public@|code_build|Builds the Code of the Project
#@public_detailed@|code_build|Syntax: 'common-cmd-syntax code_build'
#@public_detailed@|code_build|describe-common-parameters
#@public_detailed@|code_build|If the Project builds a program, i.e. the variable 'product_type' in the 'tenacitas/cpp/prj/tenacitas/$(00_project)/project.mk' file values '$(00_program_prj_type)', the executable generated is placed in the directory referenced in the variable '00_dir_product_bin', defined in 'tenacitas/cpp/prj/tenacitas/builder/main.mk'
#@public_detailed@|code_build|If the Project builds a library, i.e. the variable 'product_type' in the 'tenacitas/cpp/prj/$(00_project)/project.mk' file values '$(00_library_prj_type)', the static and dymanic libraries generated are placed in the directory referenced in the variable '00_dir_product_lib', defined in 'tenacitas/cpp/prj/tenacitas/builder/main.mk'
#@public_detailed@|code_build|If the variable 'product_type' in the 'tenacitas/cpp/prj/$(00_project)/project.mk' file values '$(00_just_copy_prj_type)', the existing files in the directory 'tenacitas/cpp/$(00_project)/' are copied to the directory referenced in the variable 'dir_dev_inc', defined in 'tenacitas/cpp/prj/tenacitas/builder/main.mk'
code_build:  code_compile input_build cfg_build
	$(00_show) ""                                                           ; \
	echo "**************************************** "                     ; \
	echo "Building code for $(00_project)"                                  ; \
	if [ $(project_product_type) = "pgm" ]; then                                   \
		$(00_make_cmd) code_build_pgm                                   ; \
	else                                                                   \
		if [ $(project_product_type) = "lib" ]; then                           \
			$(00_make_cmd) code_build_lib                           ; \
		else                                                           \
			if [ $(project_product_type) = "just_copy" ]; then             \
				$(00_make_cmd) code_build_just_copy             ; \
			fi                                                   ; \
		fi                                                           ; \
	fi                                                                   ;

#@public@|code_build_chain|Builds the Code of the Project
#@public_detailed@|code_build_chain|Syntax: 'make project=<project-name> [coc=<cpu-os-compiler>] [verbose=0/1]  [target=debug/release] code_build_chain
#@public_detailed@|code_build_chain|Where <project-name> is an existing project. Please rum 'make prj_list' to list all the avaiable projects.
#@public_detailed@|code_build_chain|Where <cpu-os-compiler> is the name of a file that contain definitions for a CPU, OS and compiler. Please, run 'make coc_list' to list all the combinations avaiables.
#@public_detailed@|code_build_chain|If the Project builds a program, i.e. the variable 'product_type' in the 'tenacitas.build_system/cpp/bin/$(00_project)/tool/gmake/project.mk' file values '$(00_program_prj_type)', the executable generated is placed in the directory referenced in the variable 'build_bin_dir', which is defined in the 'tenacitas.build_system/cpp/tool/gmake/cpu_os_comp/$(00_coc).mk' file. 
#@public_detailed@|code_build_chain|If the Project builds a libray, i.e. the variable 'product_type' in the 'tenacitas.build_system/cpp/bin/$(00_project)/tool/gmake/project.mk' file values '$(00_library_prj_type)', the static and dymanic libraries generated are placed in the directory referenced in the variable 'build_lib_dir', which is defined in the 'tenacitas.build_system/cpp/tool/gmake/cpu_os_comp/$(00_coc).mk' file. 
#@public_detailed@|code_build_chain|If the variable 'product_type' in the 'tenacitas.build_system/cpp/bin/$(00_project)/tool/gmake/project.mk' file values '$(00_just_copy_prj_type)', the existing files in the directory 'tenacitas.build_system/cpp/src/$(00_project)/code' are copied to the directory referenced in the variable 'build_inc_dir', which is defined in the 'tenacitas.build_system/cpp/tool/gmake/cpu_os_comp/$(00_coc).mk' file.
code_build_chain : input_build_chain cfg_build_chain
	$(00_show) ""                                                           ; \
	echo "**************************************** "                     ; \
	echo -n "Building the code of all Projects that $(00_project) "         ; \
	echo "depend on"                                                     ; \
	$(00_make_cmd) 01_prj_chain chain_target=code_build                        ; \
	$(00_make_cmd) code_build                                               ;


#@public@|code_clean|Cleans the Code of the Project
#@public_detailed@|code_clean|Syntax: 'make project=<project-name> [coc=<cpu-os-compiler>] [verbose=0/1]  [target=debug/release] code_clean
#@public_detailed@|code_clean|Where <project-name> is an existing project. Please rum 'make prj_list' to list all the avaiable projects.
#@public_detailed@|code_clean|Where <cpu-os-compiler> is the name of a file that contain definitions for a CPU, OS and compiler. Please, run 'make coc_list' to list all the combinations avaiables.
code_clean : 
	$(00_show) " "                                                          ; \
	echo "**************************************** "                     ; \
	echo "Cleaning the code of  $(00_project)"                              ; \
	rm -rf $(00_dir_dev_src)/*~ 2> /dev/null                                    ; \
	rm -rf $(00_dir_dev_inc)/*~ 2> /dev/null                                    ; \
	rm -rf $(00_dir_product_bin)/*$(00_project)* 2> /dev/null                          ; \
	rm -rf $(00_dir_product_lib)/*$(00_project)* 2> /dev/null                          ; \
	rm -rf $(00_dir_dev_test)/*~          2> /dev/null                           ; \
	rm -f  $(00_dir_dev_prj)/.hs  2> /dev/null                                  ; \
	rm -f  $(00_dir_dev_prj)/BROWSE 2> /dev/null                                ; \
	rm -f  $(00_dir_dev_prj)/TAGS 2> /dev/null                                  ; \
	rm -f  $(00_dir_dev_prj)/.*_current_headers*  2> /dev/null                  ; \
	rm -f  $(00_dir_dev_prj)/.*_hs 2> /dev/null                                 ; \
	rm -f  $(00_dir_dev_src)/.*deps 2> /dev/null                                ; \
	rm -f  $(00_dir_dev_obj)/*.$(coc_obj_extension) 2> /dev/null                    ; \
	rm -f  $(00_dir_dev_obj)/*.d 2> /dev/null                                   ; 

#	$(00_make_cmd) code_dep                                                 ;

#01_setup

#@public@|code_clean_chain|Cleand the code of all the projects that this project depends on, and the project itself.
#@public_detailed@|code_clean_chain|Syntax: 'make project=<project-name> [coc=<cpu-os-compiler>] [verbose=0/1]  [target=debug/release] code_clean
#@public_detailed@|code_clean_chain|Where <project-name> is an existing project. Please rum 'make prj_list' to list all the avaiable projects.
#@public_detailed@|code_clean_chain|Where <cpu-os-compiler> is the name of a file that contain definitions for a CPU, OS and compiler. Please, run 'make coc_list' to list all the combinations avaiables.
code_clean_chain :
	$(00_show) ""                                                           ; \
	echo "**************************************** "                     ; \
	echo "Cleaning the code of all Projects that $(00_project) depend on"   ; \
	$(00_make_cmd) 01_prj_chain chain_target=code_clean                        ; \
	$(00_make_cmd) code_clean                                               ; 



#@public@|code_dep|Creates the targets due to object and source files dependencies
#@public_detailed@|code_dep|Syntax: 'make project=<project-name> code_dep'
code_dep:
	$(00_show) ""                                                           ;  \
	echo "**************************************** "                     ;  \
	echo "Relating object to source files for project $(00_project)";          \
	rm -f $(00_dir_dev_obj)/*.d 2> /dev/null;                                      \
	ls $(00_dir_dev_src)/*.$(coc_source_extension) | while read source; do             \
		tmp=`echo $$source | sed 's/src/obj/g'`;                        \
		tmp1=`echo $$tmp | sed 's/dev\/cpp/dev\/X/g'`;                   \
		tmp2=`echo $$tmp1 | sed 's/$(coc_source_extension)/$(coc_obj_extension)/g'`; \
		obj=`echo $$tmp2 | sed 's/X/cpp/g'`;                            \
		tmp3=`basename $$source .$(coc_source_extension)`;                  \
		d="$(00_dir_dev_obj)/$$tmp3".d;                                        \
		echo "$$obj: $$source " >> $$d;                                 \
	done;





